package lunadevs.luna.module.exploits;

import com.zCore.Core.zCore;

import lunadevs.luna.category.Category;
import lunadevs.luna.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreenAddServer;
import net.minecraft.client.gui.GuiSleepMP;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;

public class Suicide extends Module {

	public Suicide() {
		super("Suicide", 0, Category.EXPLOITS, true);
	}
	@Override
	public void onUpdate(){
		if(!this.isEnabled) return;
		 final BlockPos bp = new BlockPos(Minecraft.thePlayer.posX, Minecraft.thePlayer.posY - 1.0, Minecraft.thePlayer.posZ);
	        if (Minecraft.thePlayer.fallDistance <= 4.0f) {
	            if (Minecraft.theWorld.getBlockState(bp).getBlock() != Blocks.air) {
	                this.mc.gameSettings.keyBindSneak.pressed = false;
	            }
	            else {
	            	if ((mc.thePlayer.fallDistance > 3.0F) && (!mc.thePlayer.onGround)) {
	            	zCore.tpRel(zCore.p().motionX, zCore.p().motionY=-0.0222, zCore.p().motionZ);
		    		zCore.tpPacket(zCore.p().motionX, zCore.p().motionY-9, zCore.p().motionZ);
		    		
	            }}
	        if ((mc.thePlayer.fallDistance > 3.0F) && (!mc.thePlayer.onGround)) {
		    	mc.thePlayer.moveEntity(mc.thePlayer.motionX, mc.thePlayer.motionY, mc.thePlayer.motionZ);
		      }
		super.onUpdate();
	        }
	}
	@Override
	public void onEnable() {
		z.addChatMessageP("§7You have to be on the edge of a block to Suicide.");
		z.addChatMessageP("§7Has to be 10+ Blocks tall.");
		super.onEnable();
	}
	
	public String getValue() {
		return "NCP";
	}
	
}
